package com.mouse.hxsj.util;

import com.mouse.hxsj.entity.common.Point;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Slf4j
public class DamoUtil {
    public static List<Point> picsToPoint(String str) {
        List<Point> list = new ArrayList<>();
        if (StringUtil.isBlank(str)) return list;
        try {
            for (String s : str.split("\\|")) {
                String[] split = s.split(",");
                if (split.length == 2) {
                    list.add(new Point(0, Integer.valueOf(split[0]), Integer.valueOf(split[1])));
                } else {
                    list.add(new Point(Integer.valueOf(split[0]), Integer.valueOf(split[1]), Integer.valueOf(split[2])));
                }
            }
        } catch (Exception e) {
            System.out.print(" 位置坐标：" + str);
            list.add(new Point(0, -1, -1));
        }
        return list;
    }
}
